home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11376 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.5 KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solutions.solon.com (Peter Seebach)
  3. Newsgroups: comp.lang.c,comp.lang.c.moderated
  4. Subject: option handling library - anyone, anyone?
  5. Date: 23 Mar 1996 11:01:58 -0600
  6. Organization: Usenet Fact Police (Undercover)
  7. Approved: seebs
  8. Message-ID: <4j1aq6$bnq@solutions.solon.com>
  9. NNTP-Posting-Host: solutions.solon.com
  10. Summary: new option handling library
  11.  
  12. I recently (well, ok, about 2 years ago) noticed that getopt() was not
  13. actually part of C.  I mislike this, because I frequently wish to get
  14. command line options, but frequently wish to use machines which are not
  15. Unix-like enuogh to have getopt.  So, I wrote my own.  I believe this
  16. source to be portable; however, I don't have enough odd machines to
  17. prove anything.
  18.  
  19. The library is available from my home page, under
  20.     http://www.solon.com/~seebs/c/getopt.html
  21. or via ftp as
  22.     ftp://taniemarie.solon.com/pub/c/ol-0.3.tar.gz
  23.  
  24. There are doubtless bugs; the logic involved in parsing options like this
  25. is pretty hairy.
  26.  
  27. The library has N+1 features, ranging from simple getopt()-like behavior
  28. through parsing complicated options, verifying that the provided values are
  29. legitimate, and other nonsense.
  30.  
  31. Testers would be appreciated, and anyone interested is welcome to grab
  32. the code and use it, under GPL or Artistic license.
  33.  
  34. If there is a positive response, I will start bundling and providing some
  35. of the other libraries I have, including my (presently mildly naive)
  36. linked list library.
  37.  
  38. This was the first one to get documented, because I hope to use it with a
  39. project a coworker is doing, which will end up (probably) being portable to
  40. various damaged hardware (i.e., machines which need trigraphs), so I want to
  41. make sure it's as portable as possible.  Note that the Makefile is not
  42. portable, but since all you need to do is compile the optlib.c file, and
  43. link it in with something, I assume the user can figure it out.  :)
  44.  
  45. I would claim it's strictly conforming, but since it calls malloc, and tests
  46. the result, it depends on implementation defined behavior.  (Note: the bug
  47. that it doesn't always test the return value of malloc has been patched
  48. in my unreleased source tree.)
  49.  
  50. (Is it cheating to call a library-built-from-a-single-module a source
  51. tree?)
  52.  
  53. -s
  54. -- 
  55. Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
  56. C/Unix wizard -- C/Unix questions? Send mail for help.  No, really!
  57. FUCK the communications decency act.  Goddamned government.  [literally.]
  58. The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
  59.